<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>管理后台</title>
    <link rel="stylesheet" type="text/css" href="../../static/css/normalize.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/css/demo.css"/>
    <!--必要样式-->
    <link rel="stylesheet" type="text/css" href="../../static/css/component.css"/>

    <!--[if IE]>
    <script src="../../js/html5.js"></script>
    <![endif]-->
</head>
<body>
<div class="container demo-1">
    <div class="content">
        <div id="large-header" class="large-header">
            <canvas id="demo-canvas"></canvas>
            <div class="logo_box">
                <h3>欢迎你</h3>
                <form action="#" name="f" method="post">
                    <div class="input_outer">
                        <span class="u_user"></span>
                        <input name="logname" class="name" style="color: #FFFFFF !important" type="text"
                               placeholder="请输入账户">
                    </div>
                    <div class="input_outer">
                        <span class="us_uer"></span>
                        <input name="logpass" class="name password"
                               style="color: #FFFFFF !important; position:absolute; z-index:100;" value=""
                               type="password" placeholder="请输入密码">
                    </div>
                    <div class="mb2" id="btn"><a class="act-but submit" href="javascript:;"
                                                 style="color: #FFFFFF">登录</a></div>
                </form>
            </div>
        </div>
    </div>
</div><!-- /container -->
<script src="../../static/js/jquery-1.12.3.js"></script>
<script src="../../static/js/sha1.js"></script>
<script src="../../static/js/TweenLite.min.js"></script>
<script src="../../static/js/EasePack.min.js"></script>
<script src="../../static/js/rAF.js"></script>
<script src="../../../static/js/demo-1.js"></script>
<script src="../../static/js/layer/layer.js"></script>
<script>
    $(function () {
        $("body").keydown(function () {
            if (event.keyCode == "13") {//keyCode=13是回车键
                $('#btn').click();
            }
        });
        // 登录处理
        $('#btn').click(function () {
            var name = $('.name').val();
            var password = $('.password').val();
            if (name == '' || password == '') {
                layer.msg('账户或密码不能为空', {icon: 8, time: 500})
                return
            }
            $.ajax({
                type: "post",
                url: "/admin/login.html",
                data: {
                    'username': name,
                    'password': password
                },
                success: function (data) {
                    console.log(data)
                    if (data.status == 'permission deny ！！！') {
                        layer.msg('账户已禁用，请联系管理员', {icon: 8, time: 500})
                    }
                    else if (data.status == 'error') {
                        layer.msg('账号或密码不正确，请重新输入', {icon: 8, time: 500})
                    }
                    else if (data.status == 'success') {
                        layer.msg('登录成功', {icon: 6, time: 500}, function () {
                            window.location = '/admin/store/list.html'
                        })
                    }
                }
            });

        });
    });
</script>
<div style="text-align:center;">
</div>
</body>
</html>